<?php

namespace App\Models;



class Category extends Orm
{
    /**
     * 关联到模型的数据表
     *
     * @var string
     */
    protected $table = 'category';

    /**
     * 表明模型是否应该被打上时间戳
     *
     * @var bool
     */
    public $timestamps = true;

    public $primaryKey = 'id';
    protected $dateFormat = 'U';


    public function secondCategory()
    {
        return $this->belongsTo(Category::class, 'pid', 'id');
    }
    public function setIconAttribute($value)
    {
        $this->dealSetImageAttribute('icon', $value);
    }
}
